$(function(){
	type = sessionStorage['type'];
	addressId = sessionStorage['addressId'];
	 Newtouch.Ajax.sendParams({addressId:addressId},localStorage['APP_AJAX_PATH']+"/drinkingBar/view/updateAddress.jsp.findAddressById",function(data){
	            $("#addressId").val(data.id);
	            $("#deliveryPersonNm").val(data.deliveryPersonNm);
	            $("#deliveryMobile").val(data.deliveryMobile);
	            $("#city").selectSetValue({value:data.city});
	            $("#area").selectSetValue({value:data.area});
	            $("#street").selectSetValue({value:data.street});
	            $("#detail").val(data.detail);
	                });

	      $("#city").mobileSelect({server:localStorage['APP_AJAX_PATH']+"/drinkingBar/view/updateAddress.jsp.queryDictionaries",catalog:"Address"});
	      $("#updateButton").bind("tap",function(){
	    	  //表单校验
	   	       var checked=$("#addressForm").check();
	   	       if(checked){
	                var formvalues=$("#addressForm").values();
	                formvalues['userId'] = sessionStorage['userId'];
	                Newtouch.Ajax.sendParams(formvalues,localStorage['APP_AJAX_PATH']+"/drinkingBar/view/updateAddress.jsp.updateAddress",function(){
	                	$(window).mobileMsgBox({msgText:"修改成功"});
	                	if(type == 1){
		                    window.location="addressManagement.html";
		                	}
		                	
		                if(type == 2){
			                   window.location="chooseAddress.html";
			                	}
	                },function(err){
	    	    	});
	   	   	    }
	       });
		
	});